package tcp28175

import (
	api "iotall/iottest/entity"
	"strconv"
	"strings"
	"time"
)

func Start() {
	var arr = strings.Split(api.GloabSetting.ServerAddr, ":")
	var Ip = strings.TrimSpace(arr[0])
	var sPort = strings.TrimSpace(arr[1])
	var port, _ = strconv.Atoi(sPort)

	for i := 1; i <= api.GloabSetting.IdCount; i++ {
		var m = &Client{
			Ip:       Ip,
			Port:     port,
			Druation: api.GloabSetting.HeathDuration,
			Id:       []byte{0, 0, 0, 0, 0, 0},
		}
		m.Id[0] = api.GloabSetting.StartId

		var vh = byte(i / 256)
		var vl = byte(i % 256)
		m.Id[4] = vh
		m.Id[5] = vl
		m.Start()
		time.Sleep(time.Millisecond)
	}
}
